﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SelectPositionSchool.aspx.cs" Inherits="School_Report_SelectPositionSchool" %>

<%@ Register Src="../../Custom/ucSubject.ascx" TagName="ucSubject" TagPrefix="uc1" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>校考前（后）X名查询</title>
    <link href="../../Common/css/main.css" rel="stylesheet" type="text/css" />  
    <script language="javascript">
    
    function Load()
    {
         var condition = document.getElementById('selCondition').value;
        var conditionObj = document.getElementById('txtCondition');
        if(condition != null && Number(condition)==1)
            conditionObj.value = "asc";
        else
            conditionObj.value = "desc";
        document.getElementById('txtIndexNum').value = document.getElementById('txtNum').value;
        document.getElementById('txtScore').value = currSubjectId;
    }
        //焦点移开后判断更新
    function optionSettingScore(obj)
    {
        s=true;
        var id = obj.parentElement.parentElement.id;
        var value = obj.value;

        if(value.length == 0 ||  ( /\D/.test(value)))
        {   
            obj.setAttribute("value",0); 
        }

    }
    
function Select()
{
    var condition = document.getElementById('selCondition').value;
    var conditionObj = document.getElementById('txtCondition');
    if(condition != null && Number(condition)==1)
        conditionObj.value = "asc";
    else
        conditionObj.value = "desc";
    document.getElementById('txtIndexNum').value = document.getElementById('txtNum').value;
    document.getElementById('txtScore').value = currSubjectId;
    document.getElementById('btnSelect').click();
}

//选中行高亮
function SetHightLight(obj)
{
    if(obj != null) 
        obj.style.backgroundColor = "#fffccf";
        
    var table = document.getElementById('selectView');
    for(var i =0 ; i < table.rows.length;i++)
    {
        var row = table.rows[i];
        if(row != null && row.rowIndex != obj.rowIndex)
        {
            row.style.backgroundColor = "#ffffff";
        }
    }
}
    
    </script>

    <link href="../../Common/css/main.css" rel="stylesheet" type="text/css" />
</head>
<body onload="Load();" scroll="no">
<div style="overflow-y:auto;overflow-x:none;height:98%;">
    <form id="form1" runat="server">
     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
     </asp:ScriptManager>
     <div class="mainWarp">
        <div class="pageBoby"  style="padding-top:5px;padding-left:5px;">
            <table >
            <tr>
            <td  style="padding-left:4px;">
                        科目：<uc1:ucSubject ID="UcSubject1" runat="server" />
                    &nbsp; &nbsp;
                     &nbsp;&nbsp;查询方式:
                    <select id="selCondition"  >
                        <option selected="selected" value="0">年级前</option>
                        <option value="1">年级后</option>
                    </select>
                <input id="txtNum" type="text" onkeypress='return event.keyCode>=48&&event.keyCode<=57;' onfocusout='optionSettingScore(this)' maxlength=4 onpaste='return false;' style="text-align:right; width: 45px;" ondragenter='return false;' value="10"/>名
                <input id="Button1" type="button" value="查询" class="commonBut" onclick="Select();" />
            </td>
            <td style="padding-left:10px;">
                <asp:UpdateProgress ID="UpdateProgress1"  runat="server" AssociatedUpdatePanelID="UpdatePanel1"><progresstemplate><img src="../../Common/images/ajaxloading.gif" /></progresstemplate></asp:UpdateProgress>
            </td>
            </tr>
            </table>

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Repeater ID="repeat" runat="server">
                <HeaderTemplate>
                <div style="overflow-y:auto;overflow-x:none;height:80%;">
                    <table id="selectView" border="0" cellpadding="0" cellspacing="1" class="useList1" style="width:600px;">
                        <tr class="tableTitle">
                            <th>排名</th>
                            <th style="text-align:left; padding-left:5px;">学号</th>
                            <th style="text-align:left; padding-left:5px;">学生</th>
                            <th style="text-align:right; padding-right:5px;">得分</th>
                            <th style="text-align:left; padding-left:5px;">所在班级</th>
                        </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                        <tr onclick="SetHightLight(this)">
                            <td style="width:100px"><%#Eval("RowIndex")%></td>
                            <td style="text-align:left; padding-left:5px;"><%#Eval("StudentCode")%></td>
                            <td style="text-align: left; padding-left: 5px;"><%#Eval("StudentName")%></td>
                            <td style="text-align: right; padding-right: 5px;"><%#Eval("Score")%></td>
                            <td style="text-align: left; padding-left: 5px;"><%#Eval("ClsName")%></td>
                        </tr>
                         </ItemTemplate>
                        <FooterTemplate>
                        
                    </table></div>
                </FooterTemplate>
                </asp:Repeater>
                <webdiyer:AspNetPager ID="AspNetPager1" runat="server" horizontalalign="left"  PageSize="15" AlwaysShow="true"
                     width="100%"   PagingButtonSpacing="10px" ButtonImageAlign="left" 
                    OnPageChanged="AspNetPager1_PageChanged">
                </webdiyer:AspNetPager>
                 <div style="display: none;">
                    <asp:Button ID="btnSelect" runat="server" Text="btnSelect" OnClick="btnSelect_Click" />
                    <asp:TextBox ID="txtIndexNum" runat="server" />
                    <asp:TextBox ID="txtCondition" runat="server" />
                    <asp:TextBox ID="txtScore" runat="server" />
                </div>
           </ContentTemplate>
           <Triggers>
               <asp:AsyncPostBackTrigger ControlID="btnSelect" EventName="Click" />
           </Triggers>
        </asp:UpdatePanel>
        </div>
        
     </div>
    </form>
    </div>
</body>
</html>
